package com.greateamd.timetableasy.client.domain;



public enum EventType {
	STUDY_PERIOD("StudyPeriod"),
	PROMOTION("Promotion"),
	USER("User"),
	UNIVERSITY("University"),
	CAMPUS("Campus"),
	COURSE("Course");

	private String text;
	
	private EventType(String text) {
		this.text = text;
	}
	
	public void setText(String text) {
		this.text = text;
	}
	
	public String getText() {
		return text;
	}
	
	public static EventType getEventTypeOf(String value){
		assert(value!=null);
		for(EventType e : EventType.values()){
			if(value.equals(e.getText()))
				return e;
		}
		return null;
	}
	
	public String getColorStyle(EventModality modality){
		EventType type = EventType.getEventTypeOf(getText());
		String colorStyle;
		switch(type){
		case STUDY_PERIOD: 
			colorStyle = "sp";
			break;
		case PROMOTION: 
			colorStyle = "promotion";
			break;
		case CAMPUS: 
			colorStyle = "campus";
			break;
		case UNIVERSITY:
			colorStyle = "university"; 
			break;
		case USER: 
			colorStyle = "user"; 
			break;
		case COURSE:
			if(modality==null){
				colorStyle = "course"; 
				break;
			}
			switch(modality){
				case COURSE: colorStyle = "courseCourse"; break;
				case DW: colorStyle = "courseDw"; break;
				case ELEARNING: colorStyle = "courseElearning"; break;
				case EXAM: colorStyle = "courseExam"; break;
				case CUSTOM: colorStyle = "courseOther"; break;
				default : colorStyle = "courseOther"; break;
			} break;

		default : colorStyle = "other"; break;
		}
		return colorStyle+"EventPanel";
	}
}